//package com.gxgeek.springrhino;
//
//import org.springframework.beans.BeansException;
//import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
//import org.springframework.beans.factory.config.BeanPostProcessor;
//import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
//import org.springframework.cglib.proxy.Enhancer;
//import org.springframework.core.PriorityOrdered;
//import org.springframework.lang.Nullable;
//
//import java.lang.reflect.Proxy;
//
///**
// * @author gaoxing
// * @create 2018-06-21 下午1:54
// */
//public class Rhino implements PriorityOrdered,BeanPostProcessor,BeanFactoryPostProcessor {
//    @Override
//    public int getOrder() {
//        return LOWEST_PRECEDENCE;
//    }
//
//    @Override
//    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
//    }
//
//    @Nullable
//    @Override
//    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
//        return bean;
//    }
//
//    @Nullable
//    @Override
//    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
//        return bean;
//    }
//
//    private static Object createProxyService(Class clazz, Object origin) {
//        Object proxy;
//        if (clazz.getInterfaces().length > 0) {
//            proxy = Proxy.newProxyInstance(clazz.getClassLoader(), clazz.getInterfaces(), new RhinoInvocationHandler(origin, clazz));
//        } else {
//            Enhancer enhancer = new Enhancer();
//            enhancer.setSuperclass(clazz);
//            enhancer.setCallback(new RhinoInvocationHandler(origin, clazz));
//            proxy = enhancer.create();
//        }
//        return proxy;
//    }
//
//}
